<!--
 * @Author: 杨三炮
 * @Date: 2021-12-03 17:42:13
 * @LastEditors: 杨三炮
 * @LastEditTime: 2021-12-03 19:56:02
 * @FilePath: \daka\src\views\Index.vue
-->
<template>
  <div class="p-4 m-0">
    <router-view></router-view>
    <van-tabbar v-model="active" class="fixed bottom-4">
      <van-tabbar-item name="home" replace to="/index" icon="home-o"
        >首页</van-tabbar-item
      >
      <van-tabbar-item name="mine" replace to="/index/mine" icon="friends-o"
        >我的</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'index',
  data () {
    return {
      active: 'home',
      showPop: false, //是否显示登录Pop框
      //获取用户登录的时候的学号
      getUserInfo: {
        sno: ''
      },
    }
  },
  created () {
    if (!localStorage.userInfo) {
      this.$toast.fail('暂未登录')
    } else {
      const userinfo = JSON.parse(localStorage.userInfo)
      console.log(userinfo);
      //token存储到vuex中
      this.$store.dispatch('setAuthenticated', userinfo)
      this.$store.dispatch('setUser', userinfo)
    }
  },

}
</script>

<style scoped>
</style>